import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as r from"../../core/sdk/sdk.js";import*as n from"../../models/workspace/workspace.js";import*as a from"./forward/forward.js";import*as i from"../../ui/legacy/legacy.js";const s={showNetwork:"Show Network",network:"Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log"},c=t.i18n.registerUIStrings("panels/network/network-meta.ts",s),l=t.i18n.getLazilyComputedLocalizedString.bind(void 0,c);let g;async function w(){return g||(g=await import("./network.js")),g}function d(e){return void 0===g?[]:e(g)}i.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:l(s.showNetwork),title:l(s.network),order:40,condition:o.Runtime.ConditionName.REACT_NATIVE_UNSTABLE_NETWORK_PANEL,loadView:async()=>(await w()).NetworkPanel.NetworkPanel.instance()}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:l(s.showNetworkRequestBlocking),title:l(s.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>(await w()).BlockedURLsPane.BlockedURLsPane.instance()}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:l(s.showNetworkConditions),title:l(s.networkConditions),persistence:"closeable",order:40,tags:[l(s.diskCache),l(s.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await w()).NetworkConfigView.NetworkConfigView.instance()}),i.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:l(s.showSearch),title:l(s.search),persistence:"permanent",loadView:async()=>(await w()).NetworkPanel.SearchNetworkView.instance()}),i.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:i.ActionRegistration.ActionCategory.NETWORK,iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>d((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>(await w()).NetworkPanel.ActionDelegate.instance(),options:[{value:!0,title:l(s.recordNetworkLog)},{value:!1,title:l(s.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.clear",category:i.ActionRegistration.ActionCategory.NETWORK,title:l(s.clear),iconClass:"clear",loadActionDelegate:async()=>(await w()).NetworkPanel.ActionDelegate.instance(),contextTypes:()=>d((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:i.ActionRegistration.ActionCategory.NETWORK,title:l(s.hideRequestDetails),contextTypes:()=>d((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>(await w()).NetworkPanel.ActionDelegate.instance(),bindings:[{shortcut:"Esc"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.search",category:i.ActionRegistration.ActionCategory.NETWORK,title:l(s.search),contextTypes:()=>d((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>(await w()).NetworkPanel.ActionDelegate.instance(),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.NETWORK,storageType:e.Settings.SettingStorageType.Synced,title:l(s.colorcodeResourceTypes),settingName:"networkColorCodeResourceTypes",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,tags:[l(s.colorCode),l(s.resourceType)],options:[{value:!0,title:l(s.colorCodeByResourceType)},{value:!1,title:l(s.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.NETWORK,storageType:e.Settings.SettingStorageType.Synced,title:l(s.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!1,tags:[l(s.netWork),l(s.frame),l(s.group)],options:[{value:!0,title:l(s.groupNetworkLogItemsByFrame)},{value:!1,title:l(s.dontGroupNetworkLogItemsByFrame)}]}),i.ViewManager.registerLocationResolver({name:"network-sidebar",category:i.ViewManager.ViewLocationCategory.NETWORK,loadResolver:async()=>(await w()).NetworkPanel.NetworkPanel.instance()}),i.ContextMenu.registerProvider({contextTypes:()=>[r.NetworkRequest.NetworkRequest,r.Resource.Resource,n.UISourceCode.UISourceCode],loadProvider:async()=>(await w()).NetworkPanel.ContextMenuProvider.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[r.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>(await w()).NetworkPanel.RequestRevealer.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIRequestLocation.UIRequestLocation],loadRevealer:async()=>(await w()).NetworkPanel.RequestLocationRevealer.instance(),destination:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[a.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>(await w()).NetworkPanel.RequestIdRevealer.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIFilter.UIRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>(await w()).NetworkPanel.NetworkLogWithFilterRevealer.instance()});
